home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue46 / ComCorn / TTTServer_TLB.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-04-28  |  5.1 KB  |  121 lines

  1. unit TTTServer_TLB;
  2.  
  3. // ************************************************************************ //
  4. // WARNING                                                                  //
  5. // -------                                                                  //
  6. // The types declared in this file were generated from data read from a     //
  7. // Type Library. If this type library is explicitly or indirectly (via      //
  8. // another type library referring to this type library) re-imported, or the //
  9. // 'Refresh' command of the Type Library Editor activated while editing the //
  10. // Type Library, the contents of this file will be regenerated and all      //
  11. // manual modifications will be lost.                                       //
  12. // ************************************************************************ //
  13.  
  14. // PASTLWTR : $Revision:   1.11.1.75  $
  15. // File generated on 4/28/99 1:28:47 AM from Type Library described below.
  16.  
  17. // ************************************************************************ //
  18. // Type Lib: C:\My Documents\DelphiMag, June99\TTT\TTTServer.tlb
  19. // IID\LCID: {BA02A6A0-FD07-11D2-AF31-0000861EF0BB}\0
  20. // Helpfile: 
  21. // HelpString: Project1 Library
  22. // Version:    1.0
  23. // ************************************************************************ //
  24.  
  25. interface
  26.  
  27. uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
  28.  
  29. // *********************************************************************//
  30. // GUIDS declared in the TypeLibrary. Following prefixes are used:      //
  31. //   Type Libraries     : LIBID_xxxx                                    //
  32. //   CoClasses          : CLASS_xxxx                                    //
  33. //   DISPInterfaces     : DIID_xxxx                                     //
  34. //   Non-DISP interfaces: IID_xxxx                                      //
  35. // *********************************************************************//
  36. const
  37.   LIBID_TTTServer: TGUID = '{BA02A6A0-FD07-11D2-AF31-0000861EF0BB}';
  38.   IID_IGameServer: TGUID = '{BA02A6A1-FD07-11D2-AF31-0000861EF0BB}';
  39.   CLASS_GameServer: TGUID = '{BA02A6A3-FD07-11D2-AF31-0000861EF0BB}';
  40.  
  41. // *********************************************************************//
  42. // Declaration of Enumerations defined in Type Library                  //
  43. // *********************************************************************//
  44. // SkillLevels constants
  45. type
  46.   SkillLevels = TOleEnum;
  47. const
  48.   slUnconcious = $00000000;
  49.   slAwake = $00000001;
  50.  
  51. // GameResults constants
  52. type
  53.   GameResults = TOleEnum;
  54. const
  55.   grInProgress = $00000000;
  56.   grTie = $00000001;
  57.   grPlayerWin = $00000002;
  58.   grComputerWin = $00000003;
  59.  
  60. type
  61.  
  62. // *********************************************************************//
  63. // Forward declaration of interfaces defined in Type Library            //
  64. // *********************************************************************//
  65.   IGameServer = interface;
  66.   IGameServerDisp = dispinterface;
  67.  
  68. // *********************************************************************//
  69. // Declaration of CoClasses defined in Type Library                     //
  70. // (NOTE: Here we map each CoClass to its Default Interface)            //
  71. // *********************************************************************//
  72.   GameServer = IGameServer;
  73.  
  74.  
  75. // *********************************************************************//
  76. // Interface: IGameServer
  77. // Flags:     (4416) Dual OleAutomation Dispatchable
  78. // GUID:      {BA02A6A1-FD07-11D2-AF31-0000861EF0BB}
  79. // *********************************************************************//
  80.   IGameServer = interface(IDispatch)
  81.     ['{BA02A6A1-FD07-11D2-AF31-0000861EF0BB}']
  82.     procedure NewGame(out GameID: Integer); safecall;
  83.     procedure PlayerMove(GameID: Integer; X: Integer; Y: Integer; out GameRez: GameResults); safecall;
  84.     procedure ComputerMove(GameID: Integer; SkillLevel: SkillLevels; out X: Integer; 
  85.                            out Y: Integer; out GameRez: GameResults); safecall;
  86.   end;
  87.  
  88. // *********************************************************************//
  89. // DispIntf:  IGameServerDisp
  90. // Flags:     (4416) Dual OleAutomation Dispatchable
  91. // GUID:      {BA02A6A1-FD07-11D2-AF31-0000861EF0BB}
  92. // *********************************************************************//
  93.   IGameServerDisp = dispinterface
  94.     ['{BA02A6A1-FD07-11D2-AF31-0000861EF0BB}']
  95.     procedure NewGame(out GameID: Integer); dispid 1;
  96.     procedure PlayerMove(GameID: Integer; X: Integer; Y: Integer; out GameRez: GameResults); dispid 2;
  97.     procedure ComputerMove(GameID: Integer; SkillLevel: SkillLevels; out X: Integer; 
  98.                            out Y: Integer; out GameRez: GameResults); dispid 3;
  99.   end;
  100.  
  101.   CoGameServer = class
  102.     class function Create: IGameServer;
  103.     class function CreateRemote(const MachineName: string): IGameServer;
  104.   end;
  105.  
  106. implementation
  107.  
  108. uses ComObj;
  109.  
  110. class function CoGameServer.Create: IGameServer;
  111. begin
  112.   Result := CreateComObject(CLASS_GameServer) as IGameServer;
  113. end;
  114.  
  115. class function CoGameServer.CreateRemote(const MachineName: string): IGameServer;
  116. begin
  117.   Result := CreateRemoteComObject(MachineName, CLASS_GameServer) as IGameServer;
  118. end;
  119.  
  120. end.
  121.